import React, { Component } from 'react';
import styled from './CarNotLogged.module.scss';

class CarLoggedAndEmpty extends Component {
    state = {
        carState: false,//false 未登录   true 商品为空
    }
    jumpToLogin = () => {
        alert("去登陆吧")
    }
    componentDidMount() {
        this.upCarState();
    }
    /* 判断carState的状态 */
    upCarState = (params) => {
        this.setState({
            carState: this.props.carStatus
        })
    }


    render() {
        return (
            <div className={styled.carNotLogged}>
                <div className={styled.header}>
                    <span>购物车</span>
                    <span className={styled.lingjuan}>领卷</span>
                </div>
                <div className={styled.welfare}>
                    <span>♥30天无忧退货</span>
                    <span>♥48小时快速退款</span>
                    <span>♥满99元免邮费</span>
                </div>
                <div className={styled.toLogin}>
                    <div className={styled.carImg}>
                        <img src="https://ss3.bdstatic.com/70cFv8Sh_Q1YnxGkpoWK1HF6hhy/it/u=4149112131,959799508&fm=26&gp=0.jpg" alt="" />
                    </div>
                    {
                        this.state.carState ? <div className={styled.emptyCar}>~去添加点什么吧~</div> : <div className={styled.login} onClick={this.jumpToLogin}>登录</div>
                    }
                </div>
            </div>
        );
    }
}

export default CarLoggedAndEmpty;